package myjavaapplication1;

/**
 *
 * @author 2010dsamant
 */
import java.awt.Color;
import java.util.*;
import java.io.*;
import javax.swing.JDialog;
import javax.swing.JOptionPane;

//Very Handy: To quickly format everything, Select everything (Ctrl+A) and then Source -> Format (Alt+Shift+F)

//I have changed mytextzor to LaymansTextBox and textArea1 to CommandTextBox

public class guitest1 extends javax.swing.JFrame {
//Other Variables are declared at the bottom

//Each Command (more or less) should have a button/component associated with it.
    //Use DecodeSensorDownlink.Convert() for the Telemetry buttons' actionPerformed
    public final String CMD_UNLOCK = ";3531";
    public final String CMD_PWR_PYLD = "4";    // enable +5_SW
    public final String CMD_OFF_PYLD = "5";  // disable +5_SW
    public final String CMD_DEPLOY = "6";   // initiate deployment of antennas
    public final String CMD_WRITE = "7";  // reserved
    public final String CMD_GET_TLM = "8";  // get a complete analog telemetry packet
    public final String CMD_GET_TLK_MSG = "9";  // reserved
    public final String CMD_GET_TLK_INT = "10";  // reserved
    public final String CMD_GET_TIME = "11";// return the value of 1 second counter
    public final String CMD_TX_EN = "12"; // enable the radio transmitter
    public final String CMD_TX_DIS = "13"; // disable the radio transmitter
    public final String CMD_SET_TLK_INT = "14";  // reserved
    public final String CMD_BCN_NOW = "15";  // provide an unmodulated carrier beacon
    public final String CMD_SET_TIME = "17";// reserved
    public final String CMD_SET_LPM = "18";  // reserved
    public final String CMD_SET_HPM = "19"; // reserved
// test commands
    public final String CMD_TEST_RESET = "20";// reset MSP430
    public final String CMD_TEST_BUILD = "21";  // provide S/W Build information
    public final String CMD_TEST_PAUSE = "22"; // do nothing for N seconds
    public final String CMD_TEST_GTICK = "23"; // return 1 Hz counter
    public int comnum=1; //ComPort # Set by text field

 //GOOD COMMANDS ADDED 7/29/11
    public final String CMD_SET_TLK_MSG = "T"; // string to send to textspeak payload
    public final String CMD_COMMAND = "C"; // string to send command following unlock



    //Old Commands
    /*  public final String CMD_NULL  = "00";
    public final String CMD_HUH         =  "01";
    public final String CMD_UNLOCK      = "02";
    public final String CMD_LOCK        = "03";
    public final String CMD_TLK_EN      = "04";
    public final String CMD_TLK_DIS     = "05";
    //public final String CMD_READ        = "06";  //idk what this should do  should write to msp memory or ds2438 memory
    //public final String CMD_WRITE       = "07";  //idk
    public final String CMD_GET_REALTLM     = "08";
    public final String CMD_GET_STORTLM     = "24";
    public final String CMD_GET_TLK_MSG = "09";
    public final String CMD_GET_TLK_INT = "10";
    //public final String CMD_GET_TIME    = "11";  //i dont think we need this cuz its in telemetry
    public final String CMD_TX_EN   	= "12";
    public final String CMD_TX_DIS      = "13";
    public final String CMD_SET_TLK_INT = "14";
    public final String CMD_TLK_NOW     = "15";  //do we need this? ADD
    public final String CMD_SET_TLK_MSG = "16";
    //public final String CMD_SET_TIME     = "17";  //but we keep time as a long..?.
    ///public final String CMD_SET_LPM     = "18";  //?  for chainging modes
    //public final String CMD_SET_HPM	= "19"; //?
    // test commands                                //unused in gnd station right? eventually, yes
    /*public final String CMD_TEST_RESET	= "20";
    public final String CMD_TEST_BUILD	= "21";
    public final String CMD_TEST_PAUSE	= "22";
    public final String CMD_TEST_GTICK	= "23";   */

    /** Creates new form guitest1 */
    public guitest1() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        jFrame1 = new javax.swing.JFrame();
        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        realsensbut = new javax.swing.JButton();
        textspeakbut = new javax.swing.JButton();
        storedsensbut = new javax.swing.JButton();
        clearbut = new javax.swing.JButton();
        RadioOnBut = new javax.swing.JRadioButton();
        RadioOffBut = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();
        LaymansTextArea = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        unlockbut = new javax.swing.JButton();
        antennasensbut = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        DeployAntennaBut = new javax.swing.JButton();
        textspeakbuton = new javax.swing.JRadioButton();
        textspeakbutoff = new javax.swing.JRadioButton();
        jLabel10 = new javax.swing.JLabel();
        jTextFieldTransmit = new javax.swing.JTextField();
        getmessagebut = new javax.swing.JButton();
        getintervalbut = new javax.swing.JButton();
        Setintervalbut = new javax.swing.JButton();
        tlkNowbut = new javax.swing.JButton();
        conversebut = new javax.swing.JButton();
        SendButton = new javax.swing.JButton();
        comButton = new javax.swing.JButton();
        CommandTextArea = new java.awt.TextArea();
        jLabel5 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jTextField1 = new javax.swing.JTextField();
        Status = new java.awt.Label();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jScrollPane3 = new javax.swing.JScrollPane();
        sensornumstatus = new javax.swing.JTextArea();
        jLabel9 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jLabel7 = new javax.swing.JLabel();
        TestButtonDelete = new javax.swing.JButton();
        comField = new javax.swing.JTextField();
        command1but = new javax.swing.JButton();
        command2but = new javax.swing.JButton();
        command3but = new javax.swing.JButton();
        command4but = new javax.swing.JButton();
        command5but = new javax.swing.JButton();
        command6but = new javax.swing.JButton();
        command7but = new javax.swing.JButton();
        command8but = new javax.swing.JButton();
        command9but = new javax.swing.JButton();
        command10but = new javax.swing.JButton();
        command11but = new javax.swing.JButton();
        command12but = new javax.swing.JButton();
        command13but = new javax.swing.JButton();
        command14but = new javax.swing.JButton();
        command15but = new javax.swing.JButton();
        command16but = new javax.swing.JButton();
        command17but = new javax.swing.JButton();
        command18but = new javax.swing.JButton();
        command19but = new javax.swing.JButton();
        command20but = new javax.swing.JButton();
        command21but = new javax.swing.JButton();
        command22but = new javax.swing.JButton();
        command23but = new javax.swing.JButton();
        command24but = new javax.swing.JButton();
        command25but = new javax.swing.JButton();
        command26but = new javax.swing.JButton();
        command27but = new javax.swing.JButton();
        command28but = new javax.swing.JButton();
        command29but = new javax.swing.JButton();
        command30but = new javax.swing.JButton();


        org.jdesktop.layout.GroupLayout jFrame1Layout = new org.jdesktop.layout.GroupLayout(jFrame1.getContentPane());
        jFrame1.getContentPane().setLayout(jFrame1Layout);
        jFrame1Layout.setHorizontalGroup(
            jFrame1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 400, Short.MAX_VALUE)
        );
        jFrame1Layout.setVerticalGroup(
            jFrame1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 300, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        realsensbut.setText("Get All RealTime Sens");
        realsensbut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                realsensbutActionPerformed(evt);
            }
        });
       // jPanel1.add(realsensbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, -1));

        textspeakbut.setText("TextSpeak (String)");
        textspeakbut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textspeakbutActionPerformed(evt);
            }
        });
      //  jPanel1.add(textspeakbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 80, -1, -1));

        storedsensbut.setText("Get All Stored Sens");
        storedsensbut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                storedsensbutActionPerformed(evt);
            }
        });
      //  jPanel1.add(storedsensbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, -1, -1));

        
        buttonGroup1.add(RadioOnBut);
        RadioOnBut.setText("On");
        RadioOnBut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RadioOnButActionPerformed(evt);
            }
        });
        //jPanel1.add(RadioOnBut, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 210, -1, 30));

        buttonGroup1.add(RadioOffBut);
        RadioOffBut.setText("Off");
        RadioOffBut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RadioOffButActionPerformed(evt);
            }
        });
        //jPanel1.add(RadioOffBut, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 210, -1, 30));

        jLabel1.setText("transmitter");
       // jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 220, -1, -1));

      
        unlockbut.setText("Unlock");
        unlockbut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                unlockbutActionPerformed(evt);
            }
        });
        //jPanel1.add(unlockbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 10, -1, -1));

        antennasensbut.setText("Get 2406 Deployment");
        antennasensbut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                antennasensbutActionPerformed(evt);
            }
        });
        //jPanel1.add(antennasensbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, -1, -1));

      

        DeployAntennaBut.setText("DeployAllAntenna");
        DeployAntennaBut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DeployAntennaButActionPerformed(evt);
            }
        });
        //jPanel1.add(DeployAntennaBut, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 110, -1, -1));

        buttonGroup2.add(textspeakbuton);
        textspeakbuton.setText("On");
        textspeakbuton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textspeakbutonActionPerformed(evt);
            }
        });
       // jPanel1.add(textspeakbuton, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 240, -1, -1));

        buttonGroup2.add(textspeakbutoff);
        textspeakbutoff.setText("Off");
        textspeakbutoff.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textspeakbutoffActionPerformed(evt);
            }
        });
      //  jPanel1.add(textspeakbutoff, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 240, -1, -1));

        jLabel10.setText("TextSpeak");
      //  jPanel1.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 240, -1, -1));

        getmessagebut.setText("Get Message");
        getmessagebut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                getmessagebutActionPerformed(evt);
            }
        });
       // jPanel1.add(getmessagebut, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 50, -1, -1));

        getintervalbut.setText("Get Talk Interval");
      //  jPanel1.add(getintervalbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 140, -1, -1));

        Setintervalbut.setText("Set Talk Interval");
        Setintervalbut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SetintervalbutActionPerformed(evt);
            }
        });
      //  jPanel1.add(Setintervalbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 140, -1, -1));

        tlkNowbut.setText("Talk Now");
        tlkNowbut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tlkNowbutActionPerformed(evt);
            }
        });
      //  jPanel1.add(tlkNowbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 140, -1, -1));

        conversebut.setText("Converse");
        conversebut.setActionCommand("ConverseButtonActionPerformed");
        conversebut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                conversebutActionPerformed(evt);
            }
        });
        getContentPane().add(conversebut, new org.netbeans.lib.awtextra.AbsoluteConstraints(1000, 470, -1, -1));

        clearbut.setText("CLEAR ALL");
        clearbut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearbutActionPerformed(evt);
            }
        });
        jPanel1.add(clearbut, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 360, -1, -1));


         LaymansTextArea.setEditable(false);
        jPanel1.add(LaymansTextArea, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 370, 326, -1));

        jLabel4.setText("TX String Pending Laymans");
        jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 350, -1, -1));


         jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jTextArea2.setText("Time,        1-A,        1-B,       1-C,       2-A,        2-B,       2-C,       3-A,        3-B,       3-C,       4-A,        4-B,       4-C,       5-A,        5-B,       5-C,       6-A,        6-B,       6-C,       7-A,        7-B,       7-C,       8-A,       9-A,       10-A,      11-A,     12-A,      13-A,       C1,         C2,         C3,         C4,         C5,         C6,         C7,         C8,         C9,         C10,        C12,        C13,        C14,        C15,        C16,        C19,        C20,        C21,        C22,        C23,        C24,        C25,        C26,        C27,        C28,        C29,        C30"+"\n");
      
        jScrollPane2.setViewportView(jTextArea2);

        jPanel1.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(1, 21, 490, 250));

        jLabel7.setText("RX");
        jPanel1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(1, 1, -1, -1));

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 1, 500, 400));

         jTextFieldTransmit.setText("                                   ");
       //  getContentPane().add(jTextFieldTransmit, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 600, -1, -1));
            


        SendButton.setText("OK Send Away");
        SendButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SendButtonActionPerformed(evt);
            }});
getContentPane().add(SendButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(880, 470, -1, -1));


            comButton.setText("Set COM #");
        comButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comButtonActionPerformed(evt);
            }
        });
        
                getContentPane().add(comButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(880, 500, -1, -1));


        CommandTextArea.setEditable(false);
        getContentPane().add(CommandTextArea, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 400, 450, 65));

        jLabel5.setText("Current TX String Pending");
        getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 380, -1, -1));

        jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jTextField1.setText("data");
       // jPanel3.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(95, 44, 140, -1));

        Status.setText("status");
      // jPanel3.add(Status, new org.netbeans.lib.awtextra.AbsoluteConstraints(1, 1, 50, -1));
        Status.getAccessibleContext().setAccessibleName("Status");

        jLabel6.setText("Battery Temp");
    //    jPanel3.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(1, 47, 90, -1));

        jLabel8.setText("PickASensor:");
     //   jPanel3.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 140, -1, -1));

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Sensor 1", "Sensor 2", "Sensor 3", "Sensor 4" }));
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });
     //   jPanel3.add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 140, -1, -1));

        sensornumstatus.setColumns(20);
        sensornumstatus.setEditable(false);
        sensornumstatus.setRows(5);
        jScrollPane3.setViewportView(sensornumstatus);

    //    jPanel3.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(11, 164, 184, 74));

        jLabel9.setText("Anntenna:");
    //    jPanel3.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 47, -1, -1));

        jTextField2.setText("Out, Out, In, Out");
    //    jPanel3.add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(355, 44, 110, -1));


          jLabel3.setText("Commands to TX");
        jPanel3.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));




         command1but.setText("CheckMainV");
        command1but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command1butActionPerformed(evt);
            }
        });
        jPanel3.add(command1but, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 20, -1, -1));

        command2but.setText("Command2");
        command2but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command2butActionPerformed(evt);
            }
        });
        jPanel3.add(command2but, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 20, -1, -1));

        command3but.setText("Command3");
        command3but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command3butActionPerformed(evt);
            }
        });
        jPanel3.add(command3but, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 20, -1, -1));

        command4but.setText("Enable+5V");
        command4but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command4butActionPerformed(evt);
            }
        });
        jPanel3.add(command4but, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 20, -1, -1));


        command5but.setText("Disable+5V");
        command5but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command5butActionPerformed(evt);
            }
        });
        jPanel3.add(command5but, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 20, -1, -1));

        command6but.setText("AntnDeplOne");
        command6but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command6butActionPerformed(evt);
            }
        });
        jPanel3.add(command6but, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 50, -1, -1));

        command7but.setText("AntnDeplAll");
        command7but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command7butActionPerformed(evt);
            }
        });
        jPanel3.add(command7but, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 50, -1, -1));

        command8but.setText("TelemPack");
        command8but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command8butActionPerformed(evt);
            }
        });
        jPanel3.add(command8but, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 50, -1, -1));

        command9but.setText("CmndMenu");
        command9but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command9butActionPerformed(evt);
            }
        });
        jPanel3.add(command9but, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 50, -1, -1));

        command10but.setText("Command10");
        command10but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command10butActionPerformed(evt);
            }
        });
        jPanel3.add(command10but, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 50, -1, -1));

        command11but.setText("1msCntr");
        command11but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command11butActionPerformed(evt);
            }
        });
        jPanel3.add(command11but, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 80, -1, -1));

        command12but.setText("EnblRadTrans");
        command12but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command12butActionPerformed(evt);
            }
        });
        jPanel3.add(command12but, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 80, -1, -1));

        command13but.setText("DisblRadTrans");
        command13but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command13butActionPerformed(evt);
            }
        });
        jPanel3.add(command13but, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 80, -1, -1));

        command14but.setText("SetupTxt");
        command14but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command14butActionPerformed(evt);
            }
        });
        jPanel3.add(command14but, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 80, -1, -1));

        command15but.setText("Beacon");
        command15but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command15butActionPerformed(evt);
            }
        });
        jPanel3.add(command15but, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 80, -1, -1));

        command16but.setText("Textspeak");
        command16but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command16butActionPerformed(evt);
            }
        });
        jPanel3.add(command16but, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 110, -1, -1));

        command17but.setText("DS2438One");
        command17but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command17butActionPerformed(evt);
            }
        });
        jPanel3.add(command17but, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 110, -1, -1));

        command18but.setText("DS2438All");
        command18but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command18butActionPerformed(evt);
            }
        });
        jPanel3.add(command18but, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 110, -1, -1));

        command19but.setText("Check 18B20");
        command19but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command19butActionPerformed(evt);
            }
        });
        jPanel3.add(command19but, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 110, -1, -1));

        command20but.setText("Debug");
        command20but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command20butActionPerformed(evt);
            }
        });
        jPanel3.add(command20but, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 110, -1, -1));

        command21but.setText("InfoS/W");
        command21but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command21butActionPerformed(evt);
            }
        });
        jPanel3.add(command21but, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 140, -1, -1));


        command22but.setText("DoNothing");
        command22but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command22butActionPerformed(evt);
            }
        });
        jPanel3.add(command22but, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 140, -1, -1));

        command23but.setText("1HzCounter");
        command23but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command23butActionPerformed(evt);
            }
        });
        jPanel3.add(command23but, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 140, -1, -1));

        command24but.setText("Command24");
        command24but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command24butActionPerformed(evt);
            }
        });
        jPanel3.add(command24but, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 140, -1, -1));

        command25but.setText("Command25");
        command25but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command25butActionPerformed(evt);
            }
        });
        jPanel3.add(command25but, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 140, -1, -1));

        command26but.setText("Command26");
        command26but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command26butActionPerformed(evt);
            }
        });
        jPanel3.add(command26but, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 170, -1, -1));

        command27but.setText("Command27");
        command27but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command27butActionPerformed(evt);
            }
         });
        jPanel3.add(command27but, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 170, -1, -1));

        command28but.setText("Command28");
        command28but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command28butActionPerformed(evt);
            }
        });
        jPanel3.add(command28but, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 170, -1, -1));

        command29but.setText("ResetCom");
        command29but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command29butActionPerformed(evt);
            }
        });
        jPanel3.add(command29but, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 170, -1, -1));

        command30but.setText("ResetComSuc");
        command30but.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                command30butActionPerformed(evt);
            }
        });
        jPanel3.add(command30but, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 170, -1, -1));
        getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 600, -1));

        jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

       
       // getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(26, 283, 509, 205));

        TestButtonDelete.setText("TestButtonDelete");
        TestButtonDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TestButtonDeleteActionPerformed(evt);
            }
        });
    //    getContentPane().add(TestButtonDelete, new org.netbeans.lib.awtextra.AbsoluteConstraints(960, 275, -1, -1));

    comField.setText("COM #");
        comField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comFieldActionPerformed(evt);
            }
        });
        getContentPane().add(comField, new org.netbeans.lib.awtextra.AbsoluteConstraints(990, 500, -1, -1));

        pack();
    }// </editor-fold>

   



    private void realsensbutActionPerformed(java.awt.event.ActionEvent evt) {
        //Real Time Sensing Query
        response += "realsensxxxxxxx, ";
        LaymansTextArea.setText(response);
        commandline += CMD_GET_TLM +";";
         flag = true;
        CommandTextArea.setText(commandline);
    }

    private void SendButtonActionPerformed(java.awt.event.ActionEvent evt) {
        CommandTextArea.setText("Sending...");
        jTextFieldTransmit.setText("Status Update: Command Sent, Waiting to Receive");
       
        File file = new File("codeztosend.txt");
        try {
            PrintStream ps = new PrintStream(file);
            ps.print(commandline);
        } catch (Exception g) {
        }
        CommandTextArea.setText("Status: Sending Command. Please Wait to Receive.");
        CommandTextArea.setBackground(Color.RED);
CommandTextArea.setForeground(Color.WHITE);

       ReadCommPortT devan = new ReadCommPortT(comnum);
        
       devan.setStuff(1, 5, kenwoodInit);

        devan.setStuff(1, 30, commandline);
        
        String rx=  devan.readData();

        
        
        
        
        //
        System.out.println("rx is:"+rx+"END");
//rx="18,#1,110,120,130,#2,210,220,230,#3,310,320,330,#4,410,420,430,#5,510,520,530,#6,610,620,630,#7,710,720,730,#8,810,820,830,#9,910,920,930,#10,1010,1020,1030,#11,1110,1120,1130,#12,1210,1220,1230;11,4500;";
//rx="11,450;";


        //String s=ReadCommPortT.toFile
        cleanArray ca=new cleanArray();
        ca.doIt(rx, jTextArea2);
        
      //if(flag){ //only display if it is the sensor data
//jTextArea2.setText(rx);
      //}
      //  rx = "00000071,0,00140C028900,1,FFFFFFFFFFFF,2,FFFFFFFFFFFF,3,FFFFFFFFFFFF,4,FFFFFFFFFFFF,5,FFFFFFFFFFFF,6,FFFFFFFFFFFF,7,FFFFFFFFFFFF,"; //Just for testing purposes

      
//meaningfuldata = ReceiveConversion.Convert(rx);

        CommandTextArea.setText("Sent...  Created File.");
        System.out.println("Sent...  Created File.");

        commandline = CMD_UNLOCK+";";     //These 4 lines are effectively the ClearButton
        response = "";
        LaymansTextArea.setText(response);
        //textArea1.setText(kenwoodInit);
        CommandTextArea.setText(commandline);
        jTextFieldTransmit.setText("");
  CommandTextArea.setBackground(Color.lightGray);
  CommandTextArea.setForeground(Color.BLACK);

    rx=""; //clear????? 9/2/11
    }

     private void comButtonActionPerformed(java.awt.event.ActionEvent evt) {

String text = comField.getText();
             comnum=Integer.parseInt(text);
           //  System.out.println(comnum);


    }

    private void RadioOnButActionPerformed(java.awt.event.ActionEvent evt) {
        ReadCommPortT devan = new ReadCommPortT(comnum);
        devan.setStuff(1, 5, kenwoodInit);
        devan.readData();

        CommandTextArea.setText("Sent...  Created File.");
        System.out.println("Sent...  Created File.");

        commandline = CMD_UNLOCK+";";
        response = "";
        LaymansTextArea.setText(response);


        /*response += "Radio On, ";
        mytextzor.setText(response);
        //commandline += "04; ";
        commandline += CMD_TX_EN + "; ";
        textArea1.setText(commandline);*/
    }

    private void RadioOffButActionPerformed(java.awt.event.ActionEvent evt) {
        response += "Radio Off, ";
        LaymansTextArea.setText(response);
        commandline += CMD_TX_DIS + ";";
        CommandTextArea.setText(commandline);
    }

    private void textspeakbutActionPerformed(java.awt.event.ActionEvent evt) {
        String arg = JOptionPane.showInputDialog(null, "Enter Text:");
        commandline += CMD_SET_TLK_MSG + ";" + arg + ";";
        response += "TextSpeak: " + arg + ", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }

    private void clearbutActionPerformed(java.awt.event.ActionEvent evt) {
        commandline = CMD_UNLOCK+";";
        response = "";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }

    private void storedsensbutActionPerformed(java.awt.event.ActionEvent evt) {
        response += "storedsensxxxxds, ";
        LaymansTextArea.setText(response);
//        commandline += CMD_GET_STORTLM+ "; ";
        CommandTextArea.setText(commandline);
    }

    private void unlockbutActionPerformed(java.awt.event.ActionEvent evt) {

        // String arg = JOptionPane.showInputDialog(null, "Passcode =   \n (Hint: ?????)");
     //   String arg = "56011"; //DELETE THIS AND UNCOMMENT THE LINE ABOVE EVENTUALLY

        //commandline +=  "02, "+ arg + ";";
      //8-12-11  commandline += CMD_UNLOCK + ";";
        response += "Unlock: " + CMD_UNLOCK + "";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
//        if(arg.compareTo("56011") == 0)
//        {
//            //Use this If-Statement to procede only with the correct passcode
//        }
//        else
//        {
//            JOptionPane.showMessageDialog(null, "Wrong Code. You might want to Clear and try again");
//        }

    }

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
        //JComboBox cb = (JComboBox)evt.getSource();
        String choice = (String) jComboBox1.getSelectedItem();
        if (choice.equals("Sensor 2")) {
            //sensornumstatus.setText("Temperature = Hot \n Voltage = low \n Current = idk");
            sensornumstatus.setText(meaningfuldata[2]);
        }
        if (choice.equals("Sensor 1")) {
            sensornumstatus.setText("Temperature = cold \n Voltage = N/A \n Current = N/A");
        }
    }

    private void antennasensbutActionPerformed(java.awt.event.ActionEvent evt) {
        response += "AntennaSens, ";
        LaymansTextArea.setText(response);
        commandline += "05;";
        CommandTextArea.setText(commandline);
    }

    private void DeployAntennaButActionPerformed(java.awt.event.ActionEvent evt) {
        response += "AntennaDeploy, ";
        LaymansTextArea.setText(response);
        commandline += "06;";
        CommandTextArea.setText(commandline);
    }

    private void textspeakbutoffActionPerformed(java.awt.event.ActionEvent evt) {
        response += "TextSpeak Ofdaffasdff, ";
        LaymansTextArea.setText(response);
///        commandline += CMD_TLK_DIS + "; ";
        CommandTextArea.setText(commandline);
    }

    private void textspeakbutonActionPerformed(java.awt.event.ActionEvent evt) {
        response += "TextSpeak Onasdadssads, ";
        LaymansTextArea.setText(response);
///        commandline += CMD_TLK_EN + "; ";
        CommandTextArea.setText(commandline);
    }

    private void getmessagebutActionPerformed(java.awt.event.ActionEvent evt) {
        response += "Get Message, ";
        LaymansTextArea.setText(response);
        commandline += CMD_GET_TLK_MSG + " ;";
        CommandTextArea.setText(commandline);
    }

    private void getintervalbutActionPerformed(java.awt.event.ActionEvent evt) {
   
        response += "Get Talk Interval, ";
        LaymansTextArea.setText(response);
        commandline += CMD_GET_TLK_INT + ";";
        CommandTextArea.setText(commandline);
        

    }

    private void SetintervalbutActionPerformed(java.awt.event.ActionEvent evt) {
        String arg = JOptionPane.showInputDialog(null, "Interval (int?) = ");   //this command may get killed becasue the satellite could just speak like 20 times and then stop
        commandline += CMD_SET_TLK_INT + "," + arg + ";";
        response += "Set Interval: " + arg + ",";  //sets textspeak broadcasting interval
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }

    private void tlkNowbutActionPerformed(java.awt.event.ActionEvent evt) {
        response += "Talk Nowasdadsadsas ";
        LaymansTextArea.setText(response);
//        commandline += CMD_TLK_NOW + "; ";
        CommandTextArea.setText(commandline);
    }

    private void TestButtonDeleteActionPerformed(java.awt.event.ActionEvent evt) {
      //This is just a test Button I created to test certain aspects of tx/rx-ing (So I wouldnt have to click multiple buttons).
        //It can be deleted in the Design window.
        response += "TESTCMDBUTTON, ";
        LaymansTextArea.setText(response);
        commandline += "02,56011;";
        commandline += " 22,3;23;22,5;23;";
        CommandTextArea.setText(commandline);
    }

    private void conversebutActionPerformed(java.awt.event.ActionEvent evt) {
        ReadCommPortT devan = new ReadCommPortT(comnum);
        devan.setStuff(1, 5, kenwoodInit);
        devan.readData();

        CommandTextArea.setText("Sent...  Created File.");
        System.out.println("Sent...  Created File.");

        commandline = CMD_UNLOCK+";";
        response = "";
        LaymansTextArea.setText(response);
    }

     private void comFieldActionPerformed(java.awt.event.ActionEvent evt) {

             String text = comField.getText();
            // Character c=text.charAt(0);
            // int asciival=(int)c;
            // System.out.println(asciival);
            // if((asciival>47)&&(asciival<58)){
             comnum=Integer.parseInt(text);
             System.out.println(comnum);
      //   }
// else{
  //               System.out.println("Please Enter a Number (e.g. 1)");
    //     }



     }
            
      private void command1butActionPerformed(java.awt.event.ActionEvent evt) {

        commandline += CMD_COMMAND + ";" + "1" + "," + "1" + ";";
        response += "Check Main V"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);


    }
      private void command2butActionPerformed(java.awt.event.ActionEvent evt) {

         commandline += CMD_COMMAND + ";" + "2" + "," + "1" + ";";
        response += "Command2: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command3butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "3" + "," + "1" + ";";
        response += "Command3: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command4butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "4" + "," + "1" + ";";
        response += "Enable +5V_SW"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command5butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "5" + "," + "1" + ";";
        response += "Disable +5V_SW"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command6butActionPerformed(java.awt.event.ActionEvent evt) {


           String arg = JOptionPane.showInputDialog(null, "Enter Antenna #:");
           commandline += CMD_COMMAND + ";" + "6" + ","+arg+";";
        response += "Deploy Individual Antenna: " +arg+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command7butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "7" + "," + "1" + ";";
        response += "Get Telemetry Packet"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
private void command8butActionPerformed(java.awt.event.ActionEvent evt) {


     commandline += CMD_COMMAND + ";" + "8" + "," + "1" + ";";
        response += "Command8: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command9butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "9" + "," + "1" + ";";
        response += "Return Menu of Raw Commands"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command10butActionPerformed(java.awt.event.ActionEvent evt) {

          commandline += CMD_COMMAND + ";" + "10" + "," + "1" + ";";
        response += "Command10: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);

    }
      private void command11butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "11" + "," + "1" + ";";
        response += "Return Value of 1ms Counter"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command12butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "12" + "," + "1" + ";";
        response += "Enable Radio Transmitter"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command13butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "13" + "," + "1" + ";";
        response += "Disable Radio Transmitter"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command14butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "14" + "," + "1" + ";";
        response += "Initialization Setup Commnds to Textspeak"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);

    }
      private void command15butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "15" + "," + "1" + ";";
        response += "Provide an Ummodulated Carrier Beacon" +", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command16butActionPerformed(java.awt.event.ActionEvent evt) {

       String arg = JOptionPane.showInputDialog(null, "Enter Text:");
        commandline +=CMD_SET_TLK_MSG + ";" + arg + ";" ;
        response += "TextSpeak: " + arg + ", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);

          
    }
      private void command17butActionPerformed(java.awt.event.ActionEvent evt) {

         String arg = JOptionPane.showInputDialog(null, "Enter DS2438 Sensor #:");

           commandline += CMD_COMMAND + ";" + "17" + ","+arg+";";
        response += "Read Individual DS2438 Sensor: " +arg+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command18butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "18" + "," + "1" + ";";
        response += "Read All DS2438 Sensors"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command19butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "19" + "," + "1" + ";";
        response += "Check 18B20 for Temp"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command20butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "20" + "," + "1" + ";";
        response += "Debug"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command21butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "21" + "," + "1" + ";";
        response += "Provide S/W Build Info" + ", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command22butActionPerformed(java.awt.event.ActionEvent evt) {


        String arg = JOptionPane.showInputDialog(null, "Do nothing for N seconds, N=");

           commandline += CMD_COMMAND + ";" + "22" + ","+arg+";";
        response += "Do nothing for " +arg+" seconds, ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command23butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "23" + "," + "1" + ";";
        response += "Return The 1hz Counter"+ ", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command24butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "24" + "," + "1" + ";";
        response += "Command24: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command25butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "25" + "," + "1" + ";";
        response += "Command25: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command26butActionPerformed(java.awt.event.ActionEvent evt) {
          //String s="18,#1,110,120,130,2,210,220,230,#3,310,320,330,#4,410,430,#5,510,520,530,#6,610,620,630,#7,710,720,730,#8,810,820,830,#9,910,920,930,#10,1010,1020,1030,#11,1110,1120,1130,#12,1210,1220,1230;11,4500;";
String s="18,#1,110,120,130,#2,210,220,230,#3,310,320,330,#4,410,420,430,#5,510,520,530,#6,610,620,630,#7,710,720,730,#8,810,#9,910,#10,1010,#11,1110,#12,1210,#13,1310;11,4500;";
// String s="11,45;";

          //String s="tHIS ID RE#I3R#340#9;4#805#UG:0????8UJGAEOR;;;GVN TTEFHGTRJK,,,G;LGEPTKGTWRPRNGTE.ODJ3OIJK4E2T//RT]ER,]TWRTG 34]24]434]KREOIJ3GQ RE43";
            cleanArray ca=new cleanArray();
        ca.doIt(s, jTextArea2);
                    
           commandline += CMD_COMMAND + ";" + "26" + "," + "1" + ";";
        response += "Command26: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command27butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "27" + "," + "1" + ";";
        response += "Command27: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      private void command28butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "28" + "," + "1" + ";";
        response += "Command28: " +"Command Details"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }

        private void command29butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline += CMD_COMMAND + ";" + "29" + "," + "1" + ";";
        response += "Reset Comm Counter"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }

          private void command30butActionPerformed(java.awt.event.ActionEvent evt) {


           commandline +=  CMD_COMMAND + ";" + "30" + "," + "1" + ";";
        response += "Reset Comm Counter"+", ";
        LaymansTextArea.setText(response);
        CommandTextArea.setText(commandline);
    }
      /**        CommandTextArea.setText(commandline);

     * @param args the command line arguments
     */
    public static void main(String args[]) {
        //JOptionPane.showMessageDialog(null,"Remember to unlock first");
          

       java.awt.EventQueue.invokeLater(new Runnable() {

           public void run() {
                new guitest1().setVisible(true);
            }
       });
    }
    // Variables declaration - do not modify
    private java.awt.TextArea CommandTextArea;
    private javax.swing.JButton DeployAntennaBut;
    private javax.swing.JTextField LaymansTextArea;
    private javax.swing.JRadioButton RadioOffBut;
    private javax.swing.JRadioButton RadioOnBut;
    private javax.swing.JButton SendButton;
    private javax.swing.JButton comButton;
    private javax.swing.JButton Setintervalbut;
    private java.awt.Label Status;
    private javax.swing.JButton TestButtonDelete;
    private javax.swing.JButton antennasensbut;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JButton clearbut;
    private javax.swing.JButton conversebut;
    private javax.swing.JButton getintervalbut;
    private javax.swing.JButton getmessagebut;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JFrame jFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JTextField jTextFieldTransmit;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private static javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JButton realsensbut;
    private javax.swing.JTextArea sensornumstatus;
    private javax.swing.JButton storedsensbut;
    private javax.swing.JButton textspeakbut;
    private javax.swing.JRadioButton textspeakbutoff;
    private javax.swing.JRadioButton textspeakbuton;
    private javax.swing.JButton tlkNowbut;
    private javax.swing.JButton unlockbut;
    private javax.swing.JButton command1but;
    private javax.swing.JButton command2but;
    private javax.swing.JButton command3but;
    private javax.swing.JButton command4but;
    private javax.swing.JButton command5but;
    private javax.swing.JButton command6but;
    private javax.swing.JButton command7but;
    private javax.swing.JButton command8but;
    private javax.swing.JButton command9but;
    private javax.swing.JButton command10but;
    private javax.swing.JButton command11but;
    private javax.swing.JButton command12but;
    private javax.swing.JButton command13but;
    private javax.swing.JButton command14but;
    private javax.swing.JButton command15but;
    private javax.swing.JButton command16but;
    private javax.swing.JButton command17but;
    private javax.swing.JButton command18but;
    private javax.swing.JButton command19but;
    private javax.swing.JButton command20but;
    private javax.swing.JButton command21but;
    private javax.swing.JButton command22but;
    private javax.swing.JButton command23but;
    private javax.swing.JButton command24but;
    private javax.swing.JButton command25but;
    private javax.swing.JButton command26but;
    private javax.swing.JButton command27but;
    private javax.swing.JButton command28but;
    private javax.swing.JButton command29but;
    private javax.swing.JButton command30but;
     private javax.swing.JTextField comField;

    // End of variables declaration
    private String commandline = CMD_UNLOCK+";";
    private String kenwoodInit = "CONVERSE";
    private String response = "";
   private boolean flag = false;
    private String[] meaningfuldata = new String[9];
}
